import Vue from 'vue'
import Router from 'vue-router'
import Index from './views/index'
import AllCourses from './views/allCourses'
import Detail from "./views/detail.vue"

Vue.use(Router);

export default new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: [
        {
            path: '*',
            redirect: '/index'
        },
        {
            path: "",
            //凡是路径中域名后面是空字符了都会被重定向到index.vue，*代表任何字符
            redirect: "/index",
        },
        {
            path: '/index',
            component: Index,
        },
        {
            path: '/all/course',
            component: AllCourses,
        },
        {
            path: "/detail",
            name: "/detail",
            component: Detail,
        }
    ]
});